﻿package com.atn.edamame {
	import mx.controls.Label; 
	import flash.events.*; 
	import mx.controls.TextArea;
	import flash.net.*;
	import flash.display.*;
	import mx.core.UIComponent;
	
	public class EdamameImage extends EdamameObject {
		private var iloader:Loader = new Loader();
		
		public function set value(data:String) :void {
			var ui:UIComponent = new UIComponent();
            configureListeners(iloader.contentLoaderInfo);
            var request:URLRequest = new URLRequest(data);
            iloader.load(request);
			ui.addChild(iloader);
			addChild(ui);
		}
		
        private function completeHandler(event:Event):void {
            iloader.width = 100;
			iloader.height = 100;
			this.width = 100;
			this.height = 100;
			this.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
        }
		
        private function configureListeners(dispatcher:IEventDispatcher):void {
            dispatcher.addEventListener(Event.COMPLETE, completeHandler);
			dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
        }
		

		private function ioErrorHandler(event:IOErrorEvent):void {
            //trace("ioErrorHandler: " + event);
        }
		
        public override function init():void {
			
        }
	}
	
}